package com;

        import org.springframework.context.annotation.Bean;
        import org.springframework.context.annotation.Configuration;
        import org.springframework.session.data.redis.config.ConfigureRedisAction;
        import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
        import org.springframework.session.web.http.DefaultCookieSerializer;

/**
 * Created by sola on 2018/1/31.
 */
@Configuration
//maxInactiveIntervalInSeconds session超时时间,单位秒
@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 6000, redisNamespace = "mysession")
public class RedisSessionConfig {

        @Bean
        public DefaultCookieSerializer defaultCookieSerializer(){
                DefaultCookieSerializer defaultCookieSerializer = new DefaultCookieSerializer();
                //跨子域
                defaultCookieSerializer.setCookiePath("/");
                return defaultCookieSerializer;
        }
        //redis-cli config set notify-keyspace-events Egx
        @Bean
        public static ConfigureRedisAction configureRedisAction() {
                return ConfigureRedisAction.NO_OP;
        }
}